#!/usr/bin/bash

# 判断用户是否存在创建用户
read -p "please input username: " user

# id user   判断用户是否存在
if id $user &>/dev/null;then 
    echo "user $user already exists."
else
    useradd $user
    if [ $? -eq 0 ];then
        echo "user $user created"
    fi
fi